package demo;

import demo.dishes.AbstractDishes;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ZhouWeiBo
 * @create 2022/6/7
 */
public class XiaoEr {

    private List<AbstractDishes> dishes = new ArrayList<>();

    public XiaoEr() {
        System.out.println("小二：“客官，小二这就来~“");
    }

    public void bookingDishes(AbstractDishes dishes) {
        System.out.println("小二：“哎这位客人您点了一份" + dishes.getDishesName() + "”");
        this.dishes.add(dishes);
    }

    public void complete() {
        System.out.println("小二：“哎这位客人您请先喝茶，我去让厨师给您出菜”");
        Kitchen kitchen = Kitchen.getInstance();
        dishes.forEach(dis -> {
            if (!kitchen.chef2Cook(dis)) {
                System.out.println("小二：“客人，您点的" + dis.getDishesName() + "得慢些时候才能上了，现在没有空余得师傅了~”");
            }
        });
        dishes.clear();
    }
}
